<%--
  Created by IntelliJ IDEA.
  User: 华为
  Date: 2025/3/16
  Time: 23:58
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Demo</title>
    <!-- 请勿在项目正式环境中引用该 layui.css 地址 -->
    <link href="//unpkg.com/layui@2.9.23/dist/css/layui.css" rel="stylesheet">
</head>
<body>
<form class="layui-form" action="">
    <input type="hidden" name="registrationId" value="${registrationVo.registrationId}">
<%--    <input type="hidden" name="authorId" value="${lib.authorId}">--%>
<%--    <input type="text" name="" value="${registrationVo.patientName}">--%>


    <div class="layui-form-item">
        <label class="layui-form-label">退号原因</label>
        <div class="layui-input-block">
            <input type="text" name="remark" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit lay-filter="demo1">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

<!-- 请勿在项目正式环境中引用该 layui.js 地址 -->
<script src="/static/js/jquery-1.8.3.js"></script>
<script src="/static/layui/layui.js"></script>
<script>
    layui.use(['form', 'laydate', 'util'], function(){
        var form = layui.form;
        var layer = layui.layer;
        var laydate = layui.laydate;
        var util = layui.util;




        // 提交事件
        form.on('submit(demo1)', function(data){
            var field = data.field; // 获取表单字段值
            // 显示填写结果，仅作演示用
            layer.alert(JSON.stringify(field), {
                title: '当前填写的字段值'
            });
            // 此处可执行 Ajax 等操作
            // …
            $.ajax({
                url: "/visit/toOut",
                type: "post",
                data: JSON.stringify(field),
                contentType:"application/json" ,
                dataType: "json",
                success(res) {
                    if(res.code==200){
                        layer.alert(res.msg)
                        location.href="/visit/toList"
                    }
                },
                error() {

                }
            })
            return false; // 阻止默认 form 跳转
        });

        // 日期
        laydate.render({
            elem: '#outTime'
        });laydate.render({
            elem: '#intoTime'
        });



    });
</script>

</body>
</html>

